ClsScene
ClsScene
 
Parameters: NONE
Returns: NONE
 

      ClsScene Clears the scene buffer of any previously captured graphic rendering events.



FACTS:


     * The Scene Buffer does not automatically clear itself



Mini Tutorial:


      This code simply creates a camera, then constantly captures a randomly coloured dot to the scenebuffer. Rather than clearing the scene buffer each loop, the code lets them stack up until either the user presses the Space Key or the 5000 limited is reached.


  
; Create camera 1.
  CreateCamera 1
  
; Start a Do/loop
  Do
   ; Tell PB to capture the following GFX comamnds
   ; to the scene Buffer
     CaptureToScene
     
   ; Get the Screen Width and height
     w=GetScreenWidth()
     h=GetScreenHeight()
     
   ; Draw a captured dot to the scenebuffer
     DotC Rnd(w),Rnd(h),RndRGB()
     
     
   ; Draw the camera
     DrawCamera 1
     
   ; After a camera is drawn, this returns PB to
   ; DrawGFXimmediate Mode, so these text commands
   ; are being drawn to the screen immediately
     
     Text 0,0,"Press Space to Clear the Scene Buffer"
     Text 0,20,"User Arrows to Move The Camera"
     
   ; If the Space Bar is pressed, then CLEAR the SCENEBUFFER
     If SpaceKey() Then ClsScene
     
   ; Check it's been too long before clearing the
   ; scene buffer.
     If Loops> 5000
        ClsScene
     Loops=0
  Else
     Inc Loops
  EndIf
  
; Control the Camera with the Arrow Keys
  If UpKey() Then MoveCamera 1,0,-5
  If DownKey() Then MoveCamera 1,0,5
  If LeftKey() Then MoveCamera 1,-5,0
  If RightKey() Then MoveCamera 1,5 ,0
  
  Sync
  Loop
  


      If you run this example, you'll set the screen slowly filling up with DOTS. This occurs because, we're not Clearing the SceneBuffer each loop through the code. So even though it's only drawing 1 dot per Loop, there slowly stacking up in the scenebuffer queue, until either the Space bar is pressed, or the 5000 limit is reached.




 
Related Info: CameraBasics | CaptureToScene | CreateCamera | DrawCamera :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com